SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE [dbo].[paObtenerTrackingDeTramite]

@IdTramite INT

AS
SET NOCOUNT ON
SELECT TT.IdTracking, TP.IdTrackingPasos, T.Nombre Tarea, TT.Desde, TT.Hasta, 
	R.Descripcion ReparticionDestino, U.Nombre Responsable, ET.Descripcion Estado
	FROM tb_Tracking TT
	INNER JOIN tb_TrackingDePasos TP ON TP.Tracking = TT.IdTracking
	INNER JOIN tb_Tareas T ON T.IdTarea = Tt.Tarea
	INNER JOIN tb_Reparticiones R ON R.IdReparticion = TT.ReparticionDestino
	LEFT OUTER JOIN tb_Usuarios U ON U.IdUsuario = TT.Responsable
	INNER JOIN tb_EstadosDeTracking ET ON Et.IdEstadoTracking = TT.Estado
	WHERE TT.Tramite = @IdTramite
GO
GRANT EXECUTE ON  [dbo].[paObtenerTrackingDeTramite] TO [GestionDeDocumentos]
GRANT EXECUTE ON  [dbo].[paObtenerTrackingDeTramite] TO [SoloVer]
GO
